package example;

import example.config.RootConfig;
import example.config.ServletConfig;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * web容器启动，创建对象
 */
public class MyWebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
    /**
     * 获取根容器配置类 Spring
     */
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[] {RootConfig.class};
    }

    /**
     * 获取子容器配置类 SpringMVC
     */
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[] {ServletConfig.class};
    }

    /**
     * 获取前端控制器映射信息
     */
    @Override
    protected String[] getServletMappings() {
        //除了jsp页面，拦截一切请求
        return new String[] {"/"};
    }
}



